Skip to content

Fix open Dependabot and CodeQL alerts - #42

Merged
oktie merged 6 commits into
mainfrom
fix/security-alerts
Nov 14, 2026
Merged

oktie merged 6 commits into
mainfrom
fix/security-alerts

Conversation

@oktie

@oktie oktie commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Fixes the open alerts listed in #18: 23 Dependabot alerts and 62 CodeQL alerts.

Dependabot PRs #34, #35, #36, #38, #40 and #41 are merged, and this branch is rebased on them. #39 was closed: see soupsieve below.

Dependencies

Package Locked version Floor in pyproject.toml Comes in through
authlib 1.9.1 (from #34) >=1.9.1 (dashboard extra) direct
joserfc 1.7.6 (from #38) >=1.7.6 (dashboard extra) authlib
certifi 2026.10.18 (from #36) >=2026.10.18 (base) requests, httpx
pyasn1 0.6.5 (from #40) >=0.6.5 (base) google-auth
litellm 1.100.4 (from #35) >=1.100.4 (litellm extra) direct
tornado 6.6.1 (from #41) >=6.6.1 (notebook extra) jupyter
soupsieve 2.9.2 → 4.1.1 >=4.0 on Python 3.11.5+ (notebook extra) beautifulsoup4 ← nbconvert
minimatch (npm) 10.2.6 → 11.0.8 override in package.json typescript-eslint (dev only)

The Dependabot PRs only changed uv.lock. The floors matter for pip install, which ignores uv.lock.

soupsieve. Every fixed soupsieve needs Python 3.11.5+. Dependabot's #39 dealt with that by locking beautifulsoup4 4.6.3 (from 2018) for older 3.11 releases. Here uv.lock covers Python 3.11.5+ only ([tool.uv] environments), and the floor has a version marker, so the package still installs on any 3.11.

minimatch. No 10.x release has the fix. typescript-estree only calls minimatch(path, pattern, opts), which 11.x keeps. Dashboard lint passes. dashboard/dist doesn't change.

CodeQL

Alerts Rule Change
44 py/path-injection Request values that become file names (benchmark ids, judge config names, SQLite db_id, logo names) go through a new safe_paths.safe_join. It accepts only plain names and checks that the result stays inside its folder. Judge configs also keep their symlink check, so a config file that links outside its folder is refused.
2 py/polynomial-redos The DB2 LIMIT regex started with \s+ and rescanned runs of spaces: about 1 second for 20,000 spaces. It now starts at the word LIMIT. Output is unchanged.
11 actions/missing-workflow-permissions ci.yml and release.yml default to permissions: contents: read.
5 see below No code change; dismissed with a reason.

Two real problems turned up while fixing the path alerts. Both endpoints are full tier, so only local operators and signed-in full users could reach them:

  • POST /api/benchmarks/{id}/execute with db_id: "../../x" opened any x.sqlite on the host.
  • The playground and the evaluation job loaded any YAML file sent as llm_judge_config_path. With the old code, a request for /etc/passwd made the job try to parse it. Now only configs from the two judge config folders are accepted, by the path the config list shows or by name. Anything else gets a 400.

Dismissed, no code change:

Python scanning was off in CodeQL default setup from Oct 27, so the Python alerts could not close. It is back on. The fixed alerts close when main is scanned after this merges.

Other

Two tests assumed the litellm extra is not installed. They now turn it off themselves.

Checks

  • pytest: 1237 passed, including 32 new tests in tests/test_path_safety.py. The three symlink tests fail without 11534f8.
  • ruff, black, mypy, uv lock --check, coverage floors: pass.
  • Dashboard: lint passes. npm audit: 0 vulnerabilities.

Closes #18

Raise floors so pip installs get the fixes, not only the lockfile:
certifi>=2026.10.18 and pyasn1>=0.6.5 in the base install,
authlib>=1.9.1 and joserfc>=1.7.6 in the dashboard extra,
litellm>=1.100.4, and soupsieve>=4.0 and tornado>=6.6.1 in the
notebook extra.

Every fixed soupsieve needs Python 3.11.5+. Its floor carries that
marker, and uv.lock now covers 3.11.5+ only ([tool.uv] environments).
Resolving for older 3.11 releases had put beautifulsoup4 4.6.3 (2018)
and an unpatched soupsieve in the lock. The package still installs on
any 3.11.

In the dashboard, override typescript-eslint's minimatch to 11.x. No
10.x release has the fix, and typescript-estree only calls
minimatch(path, pattern, opts), which 11.x keeps.

Signed-off-by: Oktie Hassanzadeh <oktie@oktie.com>
Benchmark ids, judge config names, SQLite db_ids and logo names come
from requests and end up in file names. They now go through one
helper, safe_paths.safe_join, which accepts only plain names and checks
that the normalized result stays inside its base folder. The prefix
check is the form CodeQL recognizes, which clears the py/path-injection
alerts.

Two real gaps this closes:
- A db_id such as "../../x" could open any x.sqlite on the host.
- The playground and the evaluation job loaded any YAML path sent as
  llm_judge_config_path. They now accept only a config from the two
  judge config folders (by listed path or by name) and answer 400
  otherwise.

The DB2 LIMIT rewrite started its regex with \s+, so search() rescanned
a run of spaces from every position in it: about one second for 20,000
spaces. It now starts at the word LIMIT. Output is unchanged.

Signed-off-by: Oktie Hassanzadeh <oktie@oktie.com>
Without a permissions block the jobs get the repository's default token
permissions, which can include write access (CodeQL
actions/missing-workflow-permissions). Both workflows now default to
contents: read. The publish and github-release jobs keep their own
job-level grants.

Signed-off-by: Oktie Hassanzadeh <oktie@oktie.com>
With litellm installed, an unknown model prefix is routed to LiteLLM
instead of raising UnsupportedModel. Both tests check the install
without it, so they now say so by turning litellm off.

Signed-off-by: Oktie Hassanzadeh <oktie@oktie.com>
Signed-off-by: Oktie Hassanzadeh <oktie@oktie.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The config path check permits symlinked files to escape the config directory, allowing GET to read and PUT to overwrite external files.

1 open issue
1 file not reviewed
  • dashboard/package-lock.json: Generated file
What changed in this PR

This PR addresses the security alerts tracked in #18 across the toolkit’s dependencies, dashboard API file handling, SQL execution, and GitHub Actions workflows.

Changes:

  • Raises security-related dependency floors and updates Python and dashboard lockfiles.
  • Adds shared path validation, restricts judge-config selection, and removes quadratic behavior from the DB2 LIMIT rewrite.
  • Sets read-only workflow permissions and adds regression tests.
File Description
uv.lock Updates dependency resolution and limits lockfile support to Python 3.11.5+.
tests/​test_public_api_behaviour.py Makes unknown-provider testing independent of LiteLLM installation.
tests/​test_path_safety.py Adds path-validation and DB2 rewrite regression tests.
tests/​test_model_client_dispatch.py Explicitly disables LiteLLM fallback for refusal testing.
src/​text2sql_eval_toolkit/​ui/​routers_judge.py Centralizes validation of requested judge-config paths.
src/​text2sql_eval_toolkit/​ui/​routers_judge_configs.py Updates containment terminology in a comment only.
src/​text2sql_eval_toolkit/​ui/​routers_jobs.py Validates judge-config paths before scheduling evaluations.
src/​text2sql_eval_toolkit/​ui/​routers_execution.py Validates SQLite IDs and playground judge-config paths.
src/​text2sql_eval_toolkit/​ui/​routers_benchmarks.py Uses safe joins for benchmark logo paths.
src/​text2sql_eval_toolkit/​ui/​indexes.py Rejects unsafe evaluation-artifact paths.
src/​text2sql_eval_toolkit/​safe_paths.py Adds a shared plain-name and path-containment helper.
src/​text2sql_eval_toolkit/​indexing/​store.py Validates benchmark-derived artifact paths.
src/​text2sql_eval_toolkit/​execution/​execution_tools.py Avoids repeated whitespace scanning in DB2 normalization.
pyproject.toml Raises dependency floors and configures lockfile support.
dashboard/​package.json Overrides typescript-eslint’s minimatch dependency.
dashboard/​package-lock.json Locks minimatch 11 and its dependency changes.
CHANGELOG.md Documents security fixes and compatibility constraints.
.github/​workflows/​release.yml Sets read-only default token permissions.
.github/​workflows/​ci.yml Sets read-only default token permissions.

Review effort: Balanced

Moving _contained to safe_join dropped the resolve() it used to do, so a
judge config file that is a symlink to somewhere outside its folder was
accepted again: GET read the target and PUT overwrote it. _contained now
also checks that the resolved file is directly inside the resolved
folder. A symlinked folder still works, and so does a link to another
config in the same folder.

The config list skips a config it can't use instead of failing the whole
request, and a request may name the config folder with or without
symlinks resolved, as the list used to show resolved paths.

Signed-off-by: Oktie Hassanzadeh <oktie@oktie.com>
@oktie
oktie merged commit a706348 into main Nov 14, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🔒 [IBM OSPO Security Notification] — IBM/text2sql-eval-toolkit

2 participants